﻿/*
 * Created by SharpDevelop.
 * User: amb
 * Date: 12/06/2014
 * Time: 17:05
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;

namespace JdFormsDll
{
    public static class MyFormMessageBox
    {

        public static DialogResult Show(IWin32Window owner, string text)
        {
            return ShowForm(owner,
                text,
                string.Empty,
                MessageBoxButtons.OK,
                MessageBoxIcon.None,
                MessageBoxDefaultButton.Button1);
        }

        public static DialogResult Show(IWin32Window owner, string text, string caption)
        {
            return ShowForm(owner, 
                text,
                caption,
                MessageBoxButtons.OK, 
                MessageBoxIcon.None,
                MessageBoxDefaultButton.Button1);
        }

        public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons)
        {
            return ShowForm(owner,
                text, 
                caption,
                buttons,
                MessageBoxIcon.None,
                MessageBoxDefaultButton.Button1);
        }

        public static DialogResult Show(IWin32Window owner,
            string text,
            string caption,
            MessageBoxButtons buttons,
            MessageBoxIcon icon)
        {
            return ShowForm(owner,
                text, 
                caption,
                buttons,
                icon, 
                MessageBoxDefaultButton.Button1);
        }

        public static DialogResult Show(IWin32Window owner,
            string text,
            string caption,
            MessageBoxButtons buttons,
            MessageBoxIcon icon,
            MessageBoxDefaultButton button)  
        {
            return ShowForm(owner,
                text,
                caption, 
                buttons,
                icon,
                button);
        }

        private static void pippo()
        {
            //MessageBoxButtons b0 = MessageBoxButtons.AbortRetryIgnore;
            //MessageBoxButtons b1 = MessageBoxButtons.OK;
            //MessageBoxButtons b2 = MessageBoxButtons.OKCancel;
            //MessageBoxButtons b3 = MessageBoxButtons.RetryCancel;
            //MessageBoxButtons b4 = MessageBoxButtons.YesNo;
            //MessageBoxButtons b5 = MessageBoxButtons.YesNoCancel;

            //MessageBoxIcon i0 = MessageBoxIcon.Asterisk;
            //MessageBoxIcon i0 = MessageBoxIcon.Error;
            //MessageBoxIcon i0 = MessageBoxIcon.Exclamation;
            //MessageBoxIcon i0 = MessageBoxIcon.Hand;
            //MessageBoxIcon i0 = MessageBoxIcon.Information;
            //MessageBoxIcon i0 = MessageBoxIcon.None;
            //MessageBoxIcon i0 = MessageBoxIcon.Question;
            //MessageBoxIcon i0 = MessageBoxIcon.Stop;
            //MessageBoxIcon i0 = MessageBoxIcon.Warning;

            //MessageBoxDefaultButton d = MessageBoxDefaultButton.Button1;
            //MessageBoxDefaultButton d = MessageBoxDefaultButton.Button2;
            //MessageBoxDefaultButton d = MessageBoxDefaultButton.Button3;

         

        }

        private static DialogResult ShowForm(IWin32Window owner,
            string text,
            string caption,
            MessageBoxButtons buttons,
            MessageBoxIcon icon,
            MessageBoxDefaultButton button)
        {
            DialogResult res = DialogResult.None;
            using (MyFormMessage msg = new MyFormMessage())
            {
                ((MyForm)owner).Decorator.CopyTo(msg);
                msg.Owner = (MyForm)owner;
                msg.Message = text;
                msg.Caption = caption;
                msg.Buttons = buttons;
                msg.MsgIcon = icon;
                msg.Button = button;
                res = msg.ShowDialog();
            }
            return res;
        }

    }
}
